package com.fong.spring_cloud_consumer_ribbon.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.fong.spring_cloud_consumer_ribbon.service.HelloService;

@RestController
public class HelloController {

	@Autowired
	private HelloService helloService;
	
	@Value("${server.port}")
	private String port;

	@RequestMapping( "/hello" )
	public String hello( @RequestParam String name ) {
		System.err.println( "spring-cloud-consumer-ribbon: "+port );
		return helloService.sayHello( name );
	}
}
